Skip to content

RFD: Forking of existing sessions#233

Merged
benbrandt merged 5 commits into
agentclientprotocol:mainfrom
josevalim:patch-3
Nov 20, 2025
Merged

RFD: Forking of existing sessions#233
benbrandt merged 5 commits into
agentclientprotocol:mainfrom
josevalim:patch-3

Conversation

@josevalim
Copy link
Copy Markdown
Contributor

No description provided.

@josevalim josevalim requested a review from a team November 10, 2025 16:03
@SteffenDE
Copy link
Copy Markdown
Contributor

For context: we opened agentclientprotocol/claude-agent-acp#145 to explore how this could be implemented. The PR also suggested a session/resume functionality, but that would be a separate draft.

For Claude Code, the SDK already provides the blocks we'd need to implement this: forkSession and resume. I'm imagining the API could look like this:

{
  "jsonrpc": "2.0",
  "method": "session/fork",
  "params": {
    "sessionId": "EXISTING-ACP-SESS-ID"
  }
}

Optionally, we could require to also pass any other parameters from session/new, like cwd and mcpServers for the forked session, but that might be different depending on the agent.

The agent would then reply with the same format as session/new, creating a new ACP sessionId for the forked session.

Copy link
Copy Markdown
Member

@benbrandt benbrandt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it. Added some comments, I can also take a look to figure out what we'd need to do for Codex and others as well

Comment thread docs/rfds/session-fork.mdx Outdated
Comment thread docs/rfds/session-fork.mdx Outdated
@josevalim josevalim requested a review from a team as a code owner November 17, 2025 20:22
Copy link
Copy Markdown
Member

@benbrandt benbrandt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some small tweaks to inline some examples, and also tweaked the capability structure a bit since we have a few session capabilities now (and could also make a plan to migrate the load one)

But looks good to me!

@benbrandt benbrandt merged commit 6665c44 into agentclientprotocol:main Nov 20, 2025
1 check passed
@josevalim
Copy link
Copy Markdown
Contributor Author

Thank you!!! 🥳 🍾

@faern
Copy link
Copy Markdown

faern commented May 28, 2026

And the agent would respond with optional data such as config options, the same as session/load.

I think the session/fork specification should be stricter on how it should mimic session/load. Currently the session/fork proposal does not specify that an agent MUST stream all previous session/update notifications on fork, but session/load require that.

A real world problem with this is that both OpenCode and goose implement experimental forking, but only the former stream all pre-fork notifications to the client, goose does not replay any previous messages at all. It would be great if the specification could make this consistent and unambiguous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants